﻿<?php
class Model_DbTable_Jswjggtzd extends Zend_Db_Table
{
	protected $_name = 'jswjggtzd';
	public function getFile($id)
	{
		$id = (int)$id;
		$row = $this->fetchRow('id='.$id);
		if(!$row){
			throw new Exception("无此文件，文件编号$id");
		}
		return $row->toArray();
	}
	public function addFile($old_id,$drawing_num,$file_name,$file_content,$use_for,$add_date,$scan_img='',$pdf_file='')
	{
		$data = array(
			'old_id'       => $old_id,
			'drawing_num'  => $drawing_num,
			'file_name'    => $file_name,
			'file_content' => $file_content,
			'use_for'      => $use_for,
			'add_date'     => $add_date,
			'scan_img'     => $scan_img,
			'pdf_file'	   => $pdf_file,
			
		);
		$this->insert($data);
	}
	public function updateFile($id,$drawing_num,$file_name,$file_content,$use_for,$add_date,$scan_img='',$pdf_file='')
	{
		$data = array(
			'drawing_num'=>$drawing_num,
			'file_name'=>$file_name,
			'file_content'=>$file_content,
			'use_for'=>$use_for,
			'add_date'=>$add_date,
			'scan_img'=>$scan_img,
			'pdf_file'=>$pdf_file,
		);
		$this->update($data,'id = '.$id);
	}
	public function deleteFile($id)
	{
		$this->delete('id = '.(int)$id);
	}
}